<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>耗材出库申请</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base> 
 </head>
 <body>
  <t:formvalid formid="formobj" dialog="true"  layout="table"
  	 action="consumeMeterialStockOutController.do?doAdd" tiptype="3" beforeSubmit="validateStockBalance">
		<input type="hidden" name="stockInfoId" value="${stockInfo.id}"/>
		<input type="hidden" name="stockBalance" id="stockBalance" value="${stockInfo.balance}"/>
		
		<table style="" cellpadding="0" cellspacing="1" class="formtable">
				<tr>
					<td align="right">
						<label class="Validform_label">
							耗材名称:
						</label>
					</td>
					<td class="value"> 
                	    ${stockInfo.meterial.name} 
					</td>
					
				</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							库存数量:
						</label>
					</td>
					<td class="value">
					     ${stockInfo.balance}${stockInfo.meterial.unit} 
  					</td>
				</tr>
				
			<tr>
				<td align="right">
						<label class="Validform_label">
							申请数量:
						</label>
				</td>
				<td class="value">
					     <input id="applyCount" name="applyCount" type="text"   datatype="n"
					     	style="width: 100px" class="inputxt"   maxlength="5"  onkeypress="numberValidate()">
    			</td>
			</tr> 
			<tr>
				<td align="right">
						<label class="Validform_label">
							备注信息:
						</label>
				</td>
				<td class="value">
					     <textarea id="remark" name="remark" type="text"   
					     	style="width: 200px;height:80px;" class="inputxt"   maxlength="200"  onkeypress="specialTextValidate()"></textarea>
    			</td>
			</tr> 
		</table>
	</t:formvalid>
	<script type="text/javascript">
		function validateStockBalance(){
			var balance = parseInt($('#stockBalance').val());
			var applyCount = parseInt($('#applyCount').val());
			
			if(applyCount <= 0){
				tip("申请数量应大于0！");
				return false;
			}
			
			if(applyCount > balance){
				tip('申请数量不能大于库存数量！');
				return false;
			}else{
				return true;
			}
		}
	</script>
 </body>
 